<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <style>
    .container {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background-color: #ccc;
      height: 300px;
      width: 300px;
    }

    .box:nth-child(1) {
      width: 28%;
      height: 100%;
      background-color: red;
    }

    .box:nth-child(2) {
      flex: 1;
      display: flex;
      flex-wrap: wrap;
      height: 100%;
      background-color: aqua;
    }

    .child:nth-child(1) {
      width: 100%;
      flex-basis: 100%;
      height: auto;
      background-color: #32c56b;
    }

    .child:nth-child(2) {
      width: 128px;
      word-break: break-all;
      background-color: #15562e;
    }
  </style>

  <!-- 
    1. 解决flex布局中使用百分比布局时，子元素盒子被撑开打乱布局的问题
      解决方案：使用非百分比布局的固定布局
   -->
  <div class="container">
    <div class="box">111111111</div>
    <div class="box">
      <div class="child">2222</div>
      <div class="child">assfasdfasdfasdfasdasdasdadadsfasdfadsfasd</div>
    </div>
  </div>

  <!-- 
    2. 解决在flex布局中，多个子元素换行展示，最后一个元素显示在最后一行的末尾的问题
      解决方案： margin-left: auto;
   -->
  <style>
    .container2 {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      background-color: #ccc;
      height: 300px;
      width: 300px;
    }

    .container2 .item {
      width: 28%;
      height: 100px;
      background-color: red;
    }

    .container2 .item:last-child {
      margin-left: auto;
      background-color: #32c56b;
    }
  </style>
  <div class="container2">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
  </div>
</body>

</html>